<template>
  <div class="app-container">
    <info-page-container>
      <template slot="body">
        <div class="info-page-txt-root">
          <div class="info-header-container">
            <txt-header :title="infoData.itemName"></txt-header>
          </div>
          <div class="info-body-container">
            <info-table :table-config="infoConfig" :data="infoData"></info-table>
          </div>
        </div>

      </template>
    </info-page-container>
  </div>
</template>

<script>
import {getDefectTypeInfoById} from "@/api/system/defectType";
import TxtHeader from "@/views/components/TxtHeader/index.vue";
import infoTable from "@/views/components/InfoTable/index.vue";

export default {
  components: {
    TxtHeader,
    infoTable
  },
  name: "defectType_info",
  data() {
    return {
      defectTypeId: '',
      infoData: {},
      infoConfig: [
        {
          label: '隐患大类',
          value: 'parentTypeName'
        },
        {
          label: '隐患子类',
          value: 'typeSerialName'
        },
        {
          label: '项目',
          value: 'itemName'
        },
        {
          label: '项目内容',
          value: 'itemContent'
        },
        {
          label: '基本要求',
          value: 'itemBaseContent'
        },
        {
          label: '标准分值',
          value: 'itemScore'
        },
        {
          label: '评分方法',
          value: 'itemScoreRule'
        },
        {
          label: '检查方式及内容',
          value: 'itemValidRule'
        },
        {
          label: '所需资料',
          value: 'itemArchives'
        },
        {
          label: '扣分细则',
          value: 'itemScoreDetail'
        },
      ],
    }
  },
  methods: {
    getInfoData() {
      if (this.defectTypeId == null || this.defectTypeId == '') return;
      this.startLoading('正在加载....')
      let owner = this
      getDefectTypeInfoById(this.defectTypeId).then(res => {
        owner.infoData = res.data
      }).finally(() => {
        owner.endLoading()
      })
    }
  },
  created() {
    this.defectTypeId = this.$route.query.defectTypeId
    this.getInfoData();
  },
}
</script>

<style scoped>

</style>
